package com.team.panicgame.models.mauricio;

import com.team.panicgame.GameConstants;
import com.team.panicgame.models.LivingGameObject;

public class Frog extends LivingGameObject {

	public enum State {
		IDLE, JUMP, FALL
	}
	
	public static final float HEIGHT = 5f;
	public static final float WIDTH = 5f;	
	public static final float JUMP_INITIAL_VELOCITY = 5f;
	public static final float JUMP_TIME = JUMP_INITIAL_VELOCITY / GameConstants.GRAVITY * 2f;
	
	public State state = State.IDLE;
	public boolean aboutToJump = false;
	
	public Frog(float x, float y) {
		super(x, y, WIDTH, HEIGHT);
		// TODO Auto-generated constructor stub
	}

	public float move(float delta, float velocity) {
		// update the position
		// kinematic ecuation
		// y^2 = v_0 * delta_time - 0.5 * GRAVITY * delta_time ^ 2
		float height = velocity * delta - 0.5f * GameConstants.GRAVITY * delta * delta;
		float newVelocity = velocity - GameConstants.GRAVITY * delta;
		shape.y += (float) height * MauricioWorld.ZOOM_FACTOR;
		return newVelocity;
	}
}
